/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sv.com.dizucar.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author 43579648
 */
@Entity
@Table(name = "TIPO_FACTURA", catalog = "", schema = "DIZUCAR")
@NamedQueries({
    @NamedQuery(name = "TipoFactura.findAll", query = "SELECT t FROM TipoFactura t"),
    @NamedQuery(name = "TipoFactura.findByIdtipofactura", query = "SELECT t FROM TipoFactura t WHERE t.idtipofactura = :idtipofactura"),
    @NamedQuery(name = "TipoFactura.findByTipofactura", query = "SELECT t FROM TipoFactura t WHERE t.tipofactura = :tipofactura"),
    @NamedQuery(name = "TipoFactura.findByDescripcion", query = "SELECT t FROM TipoFactura t WHERE t.descripcion = :descripcion")})
public class TipoFactura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDTIPOFACTURA", nullable = false)
    private Integer idtipofactura;
    @Basic(optional = false)
    @Column(name = "TIPOFACTURA", nullable = false, length = 20)
    private String tipofactura;
    @Basic(optional = false)
    @Column(name = "DESCRIPCION", nullable = false, length = 200)
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoFactura", fetch = FetchType.LAZY)
    private List<Venta> ventaList;

    public TipoFactura() {
    }

    public TipoFactura(Integer idtipofactura) {
        this.idtipofactura = idtipofactura;
    }

    public TipoFactura(Integer idtipofactura, String tipofactura, String descripcion) {
        this.idtipofactura = idtipofactura;
        this.tipofactura = tipofactura;
        this.descripcion = descripcion;
    }

    public Integer getIdtipofactura() {
        return idtipofactura;
    }

    public void setIdtipofactura(Integer idtipofactura) {
        this.idtipofactura = idtipofactura;
    }

    public String getTipofactura() {
        return tipofactura;
    }

    public void setTipofactura(String tipofactura) {
        this.tipofactura = tipofactura;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Venta> getVentaList() {
        return ventaList;
    }

    public void setVentaList(List<Venta> ventaList) {
        this.ventaList = ventaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipofactura != null ? idtipofactura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoFactura)) {
            return false;
        }
        TipoFactura other = (TipoFactura) object;
        if ((this.idtipofactura == null && other.idtipofactura != null) || (this.idtipofactura != null && !this.idtipofactura.equals(other.idtipofactura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.dizucar.modelo.TipoFactura[idtipofactura=" + idtipofactura + "]";
    }

}
